package com.kmproject.haifu.mvp.ui.activity;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.PhoneUtils;
import com.blankj.utilcode.util.StringUtils;
import com.flyco.roundview.RoundTextView;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DataHelper;
import com.jess.arms.widget.alertview.AlertView;
import com.jess.arms.widget.alertview.AlertViewOnItemClickListener;
import com.kmproject.haifu.R;
import com.kmproject.haifu.app.AppConstant;
import com.kmproject.haifu.app.utils.AppUtil;
import com.kmproject.haifu.app.utils.CustomGridItemDecoration;
import com.kmproject.haifu.app.utils.ExtensionUtilKt;
import com.kmproject.haifu.app.utils.ViewExtensionKt;
import com.kmproject.haifu.di.component.DaggerRentSeekingDetailComponent;
import com.kmproject.haifu.mvp.contract.RentSeekingDetailContract;
import com.kmproject.haifu.mvp.model.api.Api;
import com.kmproject.haifu.mvp.model.entity.beans.RentSeekingDetail;
import com.kmproject.haifu.mvp.model.entity.beans.UserBean;
import com.kmproject.haifu.mvp.model.entity.beans.UserHomePageBean;
import com.kmproject.haifu.mvp.model.entity.resbean.ReqParamsCancelHouseRentSeekingCollection;
import com.kmproject.haifu.mvp.presenter.RentSeekingDetailPresenter;
import com.kmproject.haifu.mvp.ui.adapter.BaseRecyclerAdapter;
import com.kmproject.haifu.mvp.ui.holder.SmartViewHolder;
import com.kmproject.haifu.mvp.ui.widget.ExpandableTextView;

import java.util.Objects;

import butterknife.BindView;
import butterknife.OnClick;

import static com.jess.arms.utils.Preconditions.checkNotNull;
import static com.luliang.shapeutils.DevShapeUtils.getContext;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 08/11/2019 11:35
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
public class RentSeekingDetailActivity extends BaseActivity<RentSeekingDetailPresenter> implements RentSeekingDetailContract.View {
    @BindView(R.id.rl_root_layout)
    RelativeLayout rl_root_layout;
    @BindView(R.id.back_right_icon)
    ImageView back_right_icon;
    @BindView(R.id.back_right_icon_1)
    ImageView back_right_icon_1;

    @BindView(R.id.rl_publisher_layout)
    RelativeLayout rl_publisher_layout;
    @BindView(R.id.imv_user_head_portrait)
    ImageView imv_user_head_portrait;
    @BindView(R.id.tv_user_name)
    TextView tv_user_name;
    @BindView(R.id.imv_level_icon)
    ImageView imv_level_icon;
    @BindView(R.id.tv_user_base_info)
    TextView tv_user_base_info;

    @BindView(R.id.tv_rent_seeking_base_info)
    TextView tv_rent_seeking_base_info;
    @BindView(R.id.tv_rent_seeking_position)
    TextView tv_rent_seeking_position;
    @BindView(R.id.ll_capacity)
    LinearLayout ll_capacity;
    @BindView(R.id.tv_capacity)
    TextView tv_capacity;
    @BindView(R.id.ll_requirement)
    LinearLayout ll_requirement;
    @BindView(R.id.tv_requirement)
    TextView tv_requirement;
    @BindView(R.id.tv_move_into_time)
    TextView tv_move_into_time;
    @BindView(R.id.tv_lease_term)
    TextView tv_lease_term;
    @BindView(R.id.ll_house_requirement)
    LinearLayout ll_house_requirement;
    @BindView(R.id.rv_house_requirement)
    RecyclerView rv_house_requirement;
    @BindView(R.id.tv_detail_desc)
    ExpandableTextView tv_detail_desc;

    @BindView(R.id.tv_publish_time)
    TextView tv_publish_time;
    @BindView(R.id.tv_view_count)
    TextView tv_view_count;

    @BindView(R.id.ll_seeking_detail_layout)
    LinearLayout ll_seeking_detail_layout;
    @BindView(R.id.ll_attention)
    LinearLayout ll_attention;
    @BindView(R.id.imv_attention)
    ImageView imv_attention;
    @BindView(R.id.imv_contact_head_portrait)
    ImageView imv_contact_head_portrait;
    @BindView(R.id.tv_contact_name)
    TextView tv_contact_name;
    @BindView(R.id.rtv_add_we_chat)
    RoundTextView rtv_add_we_chat;
    @BindView(R.id.rtv_call)
    RoundTextView rtv_call;

    @BindView(R.id.ll_personal_release_show)
    LinearLayout ll_personal_release_show;
    @BindView(R.id.tv_contact)
    TextView tv_contact;
    @BindView(R.id.tv_we_chat_no)
    TextView tv_we_chat_no;
    @BindView(R.id.tv_phone)
    TextView tv_phone;
    @BindView(R.id.rtv_edit)
    RoundTextView rtv_edit;
    @BindView(R.id.rtv_delete)
    RoundTextView rtv_delete;

    @BindView(R.id.i_divider_bar_1)
    View i_divider_bar_1;
    @BindView(R.id.i_divider_bar_2)
    View i_divider_bar_2;

    private View dialogView;
    private AlertDialog dialog;

    private String seekingId;
    private boolean existCollection = false;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerRentSeekingDetailComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .view(this)
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_rent_seeking_detail; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        Intent intent = getIntent();
        if (intent != null) {
            seekingId = intent.getStringExtra("seekingId");
        }

        showLoading();
        assert mPresenter != null;
        mPresenter.getDetail(seekingId);
    }

    @Override
    public void showLoading() {
        loadingDialog.show();
    }

    @Override
    public void hideLoading() {
        loadingDialog.dismiss();
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    private RentSeekingDetail mRentSeekingDetail;

    @OnClick({R.id.ll_attention, R.id.rtv_add_we_chat, R.id.rtv_call, R.id.back_right_icon, R.id.back_right_icon_1, R.id.rl_publisher_layout,
            R.id.rtv_personal_hp_chat, R.id.rtv_personal_hp_call, R.id.popuwindows_seelct_sx_clearTv, R.id.popuwindows_seelct_sx_sureTv,
            R.id.rtv_edit, R.id.rtv_delete})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.ll_attention:
                assert mPresenter != null;
//                ReqParamsCancelHouseRentSeekingCollection reqParamsCancelHouseRentSeekingCollection = new ReqParamsCancelHouseRentSeekingCollection();
//                Long[] ids = {Long.parseLong("1163717778372829186")};
//                reqParamsCancelHouseRentSeekingCollection.setSeekingIds(ids);
//                mPresenter.unCollectionSeeking(reqParamsCancelHouseRentSeekingCollection);
//                Map<String, Object> maps = new HashMap<>();
//                maps.put("seekingIds",ids);
//                mPresenter.unCollectionSeeking(maps);

                if (existCollection) {
                    ReqParamsCancelHouseRentSeekingCollection reqParamsCancelHouseRentSeekingCollection = new ReqParamsCancelHouseRentSeekingCollection();
                    Long[] ids = {Long.parseLong(seekingId)};
                    reqParamsCancelHouseRentSeekingCollection.setSeekingIds(ids);
                    mPresenter.unCollectionSeeking(reqParamsCancelHouseRentSeekingCollection);
                } else {
                    mPresenter.collectionSeeking(seekingId);
                }
                break;
            case R.id.rtv_add_we_chat:
                if (mRentSeekingDetail != null) {
                    if (dialogView == null) {
                        dialogView = ViewExtensionKt.inflate(rl_root_layout, R.layout.v_rent_seeking_show_we_chat, false);
                        ((TextView) dialogView.findViewById(R.id.tv_name)).setText(String.format(getString(R.string.rent_seeking_detail_fm_3), mRentSeekingDetail.getLandlord()));
                        ((TextView) dialogView.findViewById(R.id.tv_we_chat_number)).setText(mRentSeekingDetail.getWechatNumber());
                        dialogView.findViewById(R.id.tv_we_copy_we_chat).setOnClickListener(v -> {
                            ExtensionUtilKt.copyText(RentSeekingDetailActivity.this, mRentSeekingDetail.getWechatNumber());
                            showMessage("复制成功");
                            dialog.dismiss();
                        });
                    }
                    if (dialog == null) {
                        dialog = new AlertDialog.Builder(this, R.style.dialog1).create();
                    }
                    addWeChat();
                }
                break;
            case R.id.rtv_call:
                if (mRentSeekingDetail != null) {
                    PhoneUtils.dial(mRentSeekingDetail.getLandlordMobile());
                }
                break;
            case R.id.back_right_icon:

//                AppUtil.sharePopuWindow(RentSeekingDetailActivity.this, rl_root_layout);
                AppUtil.sharePopuWindow(this, rl_root_layout,tv_rent_seeking_base_info.getText().toString(),"",mRentSeekingDetail.getDetailDesc(),"", Api.SHARE_QZ_URL+String.valueOf(mRentSeekingDetail.getSeekingId()));

                break;
            case R.id.back_right_icon_1:
                // todo 消息
                AppUtil.gotoMessage(this);
                break;
            case R.id.rtv_edit:
                intent = new Intent(RentSeekingDetailActivity.this, ReleaseRentSeekingActivity.class);
                intent.putExtra("seekingId", seekingId);
                ArmsUtils.startActivity(intent);
                break;
            case R.id.rtv_delete:
                new AlertView(getString(R.string.note), getString(R.string.rent_seeking_delete_pmt), getString(R.string.cancel), new String[]{getString(R.string.sure_delete)}, null, this, AlertView.Style.Alert, new AlertViewOnItemClickListener() {

                    @Override
                    public void onItemClick(Object o, int position) {
                        if (position != AlertView.CANCELPOSITION) {
                            showLoading();
                            assert mPresenter != null;
                            mPresenter.delete(seekingId);
                        }
                    }
                }).show();
                break;
            case R.id.rl_publisher_layout:
                if (mRentSeekingDetail != null) {
                    intent = new Intent(RentSeekingDetailActivity.this, PersonalHomePageActivity.class);
                    intent.putExtra("userId", String.valueOf(mRentSeekingDetail.getUserId()));
                    ArmsUtils.startActivity(intent);
                }
                break;
        }
    }

    private void addWeChat() {
        ViewExtensionKt.showCenterDialog(dialogView, dialog, true);
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void getDetailSuccess(RentSeekingDetail rentSeekingDetail) {
        hideLoading();
        if (rentSeekingDetail != null) {
            mRentSeekingDetail = rentSeekingDetail;

            String sex = rentSeekingDetail.getLandlordGender();
            if (StringUtils.isEmpty(sex)) {
                tv_user_base_info.setText(String.format(getString(R.string.rent_seeking_detail_fm_6), rentSeekingDetail.getCreateTimeCount(), "", rentSeekingDetail.getLoginTimeCount()));
//                tv_user_base_info.setText(rentSeekingDetail.getCreateTimeCount() + rentSeekingDetail.getLoginTimeCount());
            } else {
                tv_user_base_info.setText(String.format(getString(R.string.rent_seeking_detail_fm_6), rentSeekingDetail.getCreateTimeCount(), sex + "，", rentSeekingDetail.getLoginTimeCount()));
//                tv_user_base_info.setText(rentSeekingDetail.getCreateTimeCount() + sex + "，" + rentSeekingDetail.getLoginTimeCount());
            }
//            tv_user_base_info.setText(rentSeekingDetail.getCreateTimeCount());
            getMglideImage().loadImage(this, ImageConfigImpl.builder().url(rentSeekingDetail.getAvatar()).imageRadius(5)
                    .imageView(imv_user_head_portrait)
                    .build());
            if (!StringUtils.isEmpty(rentSeekingDetail.getNickName())) {
                tv_user_name.setText(rentSeekingDetail.getNickName());
            } else {
                tv_user_name.setText("");
            }
            getMglideImage().loadImage(this, ImageConfigImpl.builder().url(rentSeekingDetail.getHeadImage()).imageRadius(5)
                    .imageView(imv_level_icon)
                    .build());

            if (AppUtil.userIsLogin(this)) {
                UserBean userBean = DataHelper.getDeviceData(this, AppConstant.USER_INFO);//获取用户信息
                assert userBean != null;
                if (userBean.getUserId().equals(String.valueOf(rentSeekingDetail.getUserId()))) {
                    rl_publisher_layout.setVisibility(View.GONE);
                    i_divider_bar_1.setVisibility(View.GONE);
                    i_divider_bar_2.setVisibility(View.VISIBLE);
                    ll_personal_release_show.setVisibility(View.VISIBLE);
                    ll_seeking_detail_layout.setVisibility(View.GONE);
                } else {
                    rl_publisher_layout.setVisibility(View.VISIBLE);
                    i_divider_bar_1.setVisibility(View.VISIBLE);
                    i_divider_bar_2.setVisibility(View.GONE);
                    ll_personal_release_show.setVisibility(View.GONE);
                    ll_seeking_detail_layout.setVisibility(View.VISIBLE);
                }
            }

            String category = rentSeekingDetail.getSeekingType();
            StringBuilder sb = new StringBuilder();
            if (!StringUtils.isEmpty(category)) {
                switch (category) {
                    case "zz":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_0), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(rentSeekingDetail.getRoomCountName()).append(rentSeekingDetail.getDrawingCountName()).append(rentSeekingDetail.getToiletCountName())
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        break;
                    case "hz":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_0), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()))
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        break;
                    case "bs":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_1), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(rentSeekingDetail.getRoomCountName()).append(rentSeekingDetail.getDrawingCountName()).append(rentSeekingDetail.getToiletCountName())
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        break;
                    case "bgs":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_1), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()))
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        ll_capacity.setVisibility(View.VISIBLE);
                        tv_capacity.setText(String.valueOf(rentSeekingDetail.getAccommodationStation()));
                        break;
                    case "sp":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_1), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()))
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        break;
                    case "cw":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_0), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        break;
                    case "cfck":
                        sb.append(String.format(getString(R.string.rent_seeking_detail_fm_1), rentSeekingDetail.getSeekingTypeName()))
                                .append(".")
                                .append(ExtensionUtilKt.appendAcreage(this, rentSeekingDetail.getLowestAcreage(), rentSeekingDetail.getHighestAcreage()))
                                .append(".")
                                .append(rentSeekingDetail.getLowestRentBudget()).append("-").append(rentSeekingDetail.getHighestRentBudget()).append(String.format(getString(R.string.rent_seeking_detail_fm_4), handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName())));
                        break;
                }
            }
            tv_rent_seeking_base_info.setText(sb.toString());
            tv_rent_seeking_position.setText(rentSeekingDetail.getParentSeekingAreaName() + rentSeekingDetail.getSeekingAreaName() + rentSeekingDetail.getPositionDescription());
            tv_requirement.setText(rentSeekingDetail.getTenancyName());
            tv_move_into_time.setText(rentSeekingDetail.getRentTime().substring(0, 10));
            tv_lease_term.setText(rentSeekingDetail.getEstimateRentingTime() + handUnit(rentSeekingDetail.getTenancy(), rentSeekingDetail.getEstimateRentingUnitName()));
            if (rentSeekingDetail.getHouseRentDetailList() != null && rentSeekingDetail.getHouseRentDetailList().size() > 0) {
                ll_house_requirement.setVisibility(View.VISIBLE);
                rv_house_requirement.addItemDecoration(new CustomGridItemDecoration.Builder(Objects.requireNonNull(getContext())).setVerticalSpan(10f).
                        setHorizontalSpan(10f).setColor(ContextCompat.getColor(getContext(), R.color.white)).setShowLastLine(false).build());
                ArmsUtils.configRecyclerView(rv_house_requirement, new GridLayoutManager(this, 3));
                rv_house_requirement.setItemAnimator(new DefaultItemAnimator());

                rv_house_requirement.setAdapter(new BaseRecyclerAdapter<RentSeekingDetail.HouseRentDetailListBean>(rentSeekingDetail.getHouseRentDetailList(), R.layout.item_release_room_feature) {
                    @Override
                    protected void onBindViewHolder(SmartViewHolder holder, RentSeekingDetail.HouseRentDetailListBean model, int position) {
                        RoundTextView textView = (RoundTextView) holder.findViewById(R.id.rtv_unique_feature);
                        textView.getDelegate().setBackgroundColor(ContextCompat.getColor(RentSeekingDetailActivity.this, R.color.color_F9D35A));
                        textView.setText(model.getBaseDictName());
                    }
                });
            } else {
                ll_house_requirement.setVisibility(View.GONE);
            }
            tv_detail_desc.setMaxLines(4);
            tv_detail_desc.setOriginalText(rentSeekingDetail.getDetailDesc());
            tv_publish_time.setText(String.format(getString(R.string.rent_seeking_detail_fm_5), rentSeekingDetail.getLatestTime()));
            tv_view_count.setText(String.format(getString(R.string.rent_seeking_detail_fm_2), rentSeekingDetail.getViewCount()));
            if ("女".equals(rentSeekingDetail.getLandlordGender())) {
                imv_contact_head_portrait.setImageResource(R.drawable.icon_avatar_female);
            } else {
                imv_contact_head_portrait.setImageResource(R.drawable.icon_avatar_male);
            }
            tv_contact_name.setText(rentSeekingDetail.getLandlord());
            tv_contact.setText(rentSeekingDetail.getLandlord());
            tv_we_chat_no.setText(mRentSeekingDetail.getWechatNumber());
            String[] strings = ExtensionUtilKt.handleMobile(mRentSeekingDetail.getLandlordMobile());
            tv_phone.setText("+" + strings[0] + " " + strings[1]);

            existCollection = rentSeekingDetail.isExistCollection();
            if (existCollection) {
                imv_attention.setImageResource(R.drawable.icon_attention);
            } else {
                imv_attention.setImageResource(R.drawable.icon_un_attention);
            }
//            assert mPresenter != null;
//            mPresenter.getUserHomePageInfo(String.valueOf(rentSeekingDetail.getUserId()));
        }
    }

    private String handUnit(String tenancy, String oldUnit) {
        if (tenancy.equals("short")) {//租期要求:short-短租，lasting-长租
            return getString(R.string.day_t);
        }
        return oldUnit;
    }

    @Override
    public void deleteSuccess() {
        hideLoading();
        showMessage(getString(R.string.success));
        killMyself();
    }

    @Override
    public void followSuccess() {

    }

    @Override
    public void collectionSeekingSuccess() {
        showMessage("收藏成功");
        imv_attention.setImageResource(R.drawable.icon_attention);
        existCollection = true;
    }

    @Override
    public void unCollectionSeekingSuccess() {
        showMessage("取消成功");
        imv_attention.setImageResource(R.drawable.icon_un_attention);
        existCollection = false;
    }

    @Override
    public void showUserInfo(UserHomePageBean bean) {
        if (bean != null) {
            tv_user_base_info.setText(bean.getLoginTimeCount());
            if (bean.getBaseUser() != null) {
                String sex = bean.getBaseUser().getUserSex();
                if (StringUtils.isEmpty(sex)) {
//                    tv_user_base_info.setText(String.format(getString(R.string.rent_seeking_detail_fm_6), bean.getCreateTimeCount(), "", bean.getLoginTimeCount()));
                    tv_user_base_info.setText(bean.getCreateTimeCount() + bean.getLoginTimeCount());
                } else {
//                    tv_user_base_info.setText(String.format(getString(R.string.rent_seeking_detail_fm_6), bean.getCreateTimeCount(), sex + "，", bean.getLoginTimeCount()));
                    tv_user_base_info.setText(bean.getCreateTimeCount() + sex + "，" + bean.getLoginTimeCount());
                }
                getMglideImage().loadImage(this, ImageConfigImpl.builder().url(bean.getBaseUser().getAvatar()).imageRadius(5)
                        .imageView(imv_user_head_portrait)
                        .build());
                if (!StringUtils.isEmpty(bean.getBaseUser().getNickName())) {
                    tv_user_name.setText(bean.getBaseUser().getNickName());
                } else {
                    tv_user_name.setText(bean.getBaseUser().getUserName());
                }
            }
            UserHomePageBean.MemberLevelBean memberLevelBean = bean.getMemberLevel();
            if (memberLevelBean != null) {
                getMglideImage().loadImage(this, ImageConfigImpl.builder().url(memberLevelBean.getHeadImage()).imageRadius(5)
                        .imageView(imv_level_icon)
                        .build());
            }
        }
    }

// todo 暂时注释
//    @Subscriber(mode = ThreadMode.MAIN)
//    public void reciverLocation(String flag) {
//        if (flag.equals(EventBusTags.RELEASE_RENT_SEEKING_SUCCESS)) {
//            killMyself();
//        }
//    }
}
